package com.komodo.island.gdx.dialog;

import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.actors.Button;
import com.komodo.island.gdx.Input;
import com.komodo.island.gdx.KomodoIsland;
import com.komodo.island.gdx.Persistence;
import com.komodo.island.gdx.screen.MapScreen;
import com.komodo.island.gdx.screen.Screen;

public class MapTouristDialog extends MapDialog {

	Button buttonUnderWater;
	Button buttonSandCastle;
	Button buttonShopping;

	public MapTouristDialog(float width, float height, boolean stretch,
			Screen screen, Texture texture,KomodoIsland komodoIsland) {
		super(width, height, stretch, screen, texture,komodoIsland);
		// TODO Auto-generated constructor stub
		this.ID = Input.DIALOG_TOURIST_MAP;
	}

	@Override
	public void init() {
		// TODO Auto-generated method stub
		super.init();
		buttonUnderWater = new Button("underwater", new TextureRegion(
				screen.komodoIsland.buttonTexture, 480, 0, 100, 100));
		buttonSandCastle = new Button("sand", new TextureRegion(
				screen.komodoIsland.buttonTexture, 0, 200, 90, 54));
		buttonShopping = new Button("shopping", new TextureRegion(
				screen.komodoIsland.buttonTexture, 480, 100, 64, 64));

	}

	@Override
	public void addElements() {
		// TODO Auto-generated method stub
		super.addElements();
		if (Persistence.levelUnlocked[Persistence.SHOPPING])
			addActor(buttonShopping);
		if (Persistence.levelUnlocked[Persistence.CASTLE])
			addActor(buttonSandCastle);
		if (Persistence.levelUnlocked[Persistence.UNDERWATER])
			addActor(buttonUnderWater);

	}

	@Override
	public void setThePosition() {
		// TODO Auto-generated method stub
		super.setThePosition();
		buttonSandCastle.x = 56;
		buttonSandCastle.y = 206;
		buttonUnderWater.x = 158;
		buttonUnderWater.y = 148;
		buttonShopping.x = 41;
		buttonShopping.y = 105;

	}

	@Override
	public void setTheListener() {
		// TODO Auto-generated method stub
		super.setTheListener();
		buttonUnderWater.clickListener = new Button.ClickListener() {

			public void clicked(Button arg0) {
				// TODO Auto-generated method stub
				if (Persistence.sound)
					screen.komodoIsland.mapSound.play(1);
				((MapScreen) screen).showGameDesc(MapScreen.UNDERWATER);
			}
		};
		buttonSandCastle.clickListener = new Button.ClickListener() {

			public void clicked(Button arg0) {
				// TODO Auto-generated method stub
				if (Persistence.sound)
					screen.komodoIsland.mapSound.play(1);
				((MapScreen) screen).showGameDesc(MapScreen.CASTLE);
			}
		};
		buttonShopping.clickListener = new Button.ClickListener() {

			public void clicked(Button arg0) {
				// TODO Auto-generated method stub
//				if (Persistence.sound)
//					screen.komodoIsland.mapSound.play(1);
//				((MapScreen) screen).showGameDesc(MapScreen.SHOPPING);
			}
		};

	}

}
